﻿using Autofac.Core;
using AutoMapper;
using MediatR;
using SheepStorage.API.Application.Command.BodySizeCommand;
using SheepStorage.API.Application.Command.SheepRecordCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.DTO.Output;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepRecordHandlers
{
    public class AllSheepRecordHandlers : IRequestHandler<AllSheepRecordCommand, Results<List<SheepRecord>>>
    {
        ISheepRecordService _service;
       
        public AllSheepRecordHandlers(ISheepRecordService service)
        {
            _service = service;
            
        }
        public async Task<Results<List<SheepRecord>>> Handle(AllSheepRecordCommand request, CancellationToken cancellationToken)
        {
            return Results<List<SheepRecord>>.DataResult(await _service.GetSheepRecordAll());
        }
    }
}
